import { POST } from '../axios.config.js'

const base = window.config.ip
const scheme = `${base}/rcdg-zbkh/ind-index-report-cfg`
const indexReport = `${base}/rcdg-zbkh/index-report`

const URLS = {
  saveReportCfg: `${scheme}/saveReportCfg`, // 新增考核方案
  listAssessUser: `${scheme}/listAssessUser`, // 获取考核主体人员
  listReportCfg: `${scheme}/listReportCfg`, // 获取考核方案列表
  getReportCfg: `${scheme}/getReportCfg`, // 获取考核方案详情
  executeIndexReport: `${scheme}/executeIndexReport`, // 确认发起考核
  delReportCfg: `${scheme}/delReportCfg`, // 删除考核方案
  getReportCfgStat: `${scheme}/getReportCfgStat`, // 获取绩效考核状态统计
  getIndexCfgStat: `${indexReport}/getReportCfgStat`, // 获取单位绩效考核状态统计
  listIndexCfg: `${indexReport}/listReportCfg`, // 单位指标推送管理
}
// 新增考核方案
export const saveReportCfg = ({
  id = '',
  status = '-1',
  modelId,
  title = '',
  reportExplain = '',
  year,
  reviewOrgList = [],
  recallEnd = '',
  recallStart = '',
  reviewProcessList = [],
  type,
}) =>
  POST(URLS.saveReportCfg, {
    id,
    status,
    type,
    modelId,
    title,
    reportExplain,
    year,
    reviewOrgList,
    recallStart,
    recallEnd,
    reviewProcessList,
  })

// 获取考核主体人员
export const listAssessUser = key => POST(URLS.listAssessUser, { key })

// 获取考核方案列表
export const listReportCfg = (currentPage = 1, pageSize = 10, param = { title: '', type: '', status: '' }) =>
  POST(URLS.listReportCfg, { currentPage, pageSize, param })

// 获取考核方案列表-单位指标推送管理
export const listIndexCfg = (currentPage = 1, pageSize = 10, param = { title: '', type: '', status: '' }) =>
  POST(URLS.listIndexCfg, { currentPage, pageSize, param })

// 获取考核方案详情
export const getReportCfg = id => POST(URLS.getReportCfg, { id })

// 确认发起考核
export const executeIndexReport = id => POST(URLS.executeIndexReport, { id })

// 删除考核方案
export const delReportCfg = id => POST(URLS.delReportCfg, { id })

// 获取绩效考核状态统计-工作人员
export const getReportCfgStat = () => POST(URLS.getReportCfgStat)

// 获取单位绩效考核状态统计
export const getIndexCfgStat = () => POST(URLS.getIndexCfgStat)
